<template>
  <el-dialog
    title="卡列表"
    :visible.sync="dialogFormVisible"
    width="50%"
    v-loading="loading"
  >
    <el-table :data="tableData" style="width: 100%" stripe v-loading="loading">
      <el-table-column label="卡名称" prop="cardName"></el-table-column>
      <el-table-column label="卡类型" prop="phone"><p>畅玩卡</p></el-table-column>
      <el-table-column label="卡面" prop="memberName">
       <template slot-scope="scope">
        {{setCard(scope.row.cardType)}}

       </template>
      </el-table-column>
      <!-- <el-table-column label="使用时间" prop="dailyCardDateStr"></el-table-column> -->

      <el-table-column
        label="剩余（天）"
        prop="plusDate"
      ></el-table-column>
    </el-table>
    <div slot="footer" class="dialog-footer">
      <el-button @click="dialogFormVisible = false">取 消</el-button>
      <el-button :type="state ? 'primary' : 'info'" @click="submit"
        >确 定</el-button
      >
    </div>
  </el-dialog>
</template>
<script>

import { memberDailyCardPageList } from '@/config/api'
import { times, divide } from "@/utils/tools"

export default {
  data () {
    return {
      dialogFormVisible: false,
      tableData: [],
    };
  },

  methods: {
   setCard(type){
     let str = ""
     switch(type){
      case "0":
      str = "全天"
      break;
      case "1":
      str = "早"
      break;
      case "2":
      str = "中"
      break;
      case "3":
      str = "晚"
      break;
     }
     return str
    },
    show (record) {
      this.getList(record)
      this.dialogFormVisible = true
    },

    submit () {
      this.dialogFormVisible = false

    },
    getList (phone) {
      memberDailyCardPageList({ phone  }).then(res => {
        this.tableData = res.data.result.list

      })
    }

  }
};
</script>
<style lang="scss">
.redPack {
  display: flex;
  flex-wrap: wrap;
  p {
    margin-right: 20px;
  }
}
</style>